﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public static class EXT
    {
        public static int? ToInt(this string str)
        {
            if (string.IsNullOrEmpty(str))
            {
                return null;
            }

            return Convert.ToInt32(str);
        }

        public static bool ToBool(this string str)
        {
            if ("1".Equals(str))
            {
                return true;
            }

            return false;
        }

        public static string ToString2(this int? val)
        {
            if (val == null)
            {
                return string.Empty;
            }

            return val.ToString();
        }
    }
}
